package com.valuedaas.schoolsafety.wxtool.handler;

import com.mongodb.client.model.Filters;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
import org.bson.Document;
import org.bson.conversions.Bson;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * @author Binary Wang(https://github.com/binarywang)
 */
@Component
public class MsgHandler extends AbstractHandler {

	static final String EVENT_TYPE = "message";

	@SuppressWarnings("unchecked")
	@Override
	public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context, WxMpService weixinService,
			WxSessionManager sessionManager) {

		String msgType = wxMessage.getMsgType();
		String msgContent = wxMessage.getContent();

		String openid = wxMessage.getFromUser();

		return null;
	}

	/**
	 * 目前能处理的消息类型
	 * 
	 * @param msgType
	 * @return
	 */
	private boolean isCanHandleType(String msgType) {
		return msgType.equals(WxConsts.XmlMsgType.TEXT) || msgType.equals(WxConsts.XmlMsgType.IMAGE)
				|| msgType.equals(WxConsts.XmlMsgType.VOICE) || msgType.equals(WxConsts.XmlMsgType.VIDEO);
	}
}
